#pragma once

#include "Primitive.h"
#include "Vector3.h"

namespace RayTracer
{

	class CSphere : public CPrimitive
	{
	public:
		CSphere(const CVector3& center, const float& radius);
		virtual ~CSphere(void);

		CVector3 getCenter() { return m_Center; }
		float getRadius() { return m_Radius; }
		float getSquareRadius() { return m_SquareRadius; }
		float getInverseRadius() { return m_InvRadius; }

		virtual PrimitiveType getType() { return SPHERE; }
		virtual IntersectionStatus IntersectRay(CRay& ray, float& dist);
		virtual CVector3 getNormal(const CVector3& pos);

	private:
		CVector3 m_Center;
		float m_Radius;

		// For computation speed up
		float m_SquareRadius;
		float m_InvRadius;
	};

}